﻿<KCtl:BaseUserControl  xmlns:my="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps"  x:Class="Kiva7.Pages.MainMapControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:KCtl="clr-namespace:Kiva7.Controls"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">

    <Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">
        <my:Map 
            x:Name="map"
            CopyrightVisibility="Collapsed" 
            LogoVisibility="Collapsed"
            ZoomBarVisibility="Collapsed"
            CredentialsProvider="AiIzN2Gv9GY6crsUn3qGEfaOAHBZYA5wzoLB49y55JJT_YgVBDGQRfclRPtix2E5">

            <my:Map.Mode>
                <my:AerialMode ShouldDisplayLabels="True" />
            </my:Map.Mode>

            <my:MapItemsControl
                    x:Name="LoanPins" 
                    ItemsSource="{Binding Loans.Outstanding}" UseLayoutRounding="True">
                <my:MapItemsControl.ItemTemplate>
                    <DataTemplate>
                        <my:Pushpin Location="{Binding Location.Geo.Coordinate}" Width="60" Height="55">

                            <Button Click="Pushpin_Click" BorderThickness="0" Width="60" Height="55" 
                                    DataContext="{Binding}" 
                                    HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
                                <KCtl:KivaImageControl x:Name="imgLender" Margin="-50,-50,-50,-50"
                                   ImageData="{Binding Image}" ImageSize="Small" 
                                   Width="60" Height="55" 
                                    VerticalAlignment="Stretch" 
                                   HorizontalAlignment="Stretch"/>
                            </Button>
                        </my:Pushpin>
                    </DataTemplate>
                </my:MapItemsControl.ItemTemplate>
            </my:MapItemsControl>


        </my:Map>
    </Grid>
</KCtl:BaseUserControl >
